package com.cssy.xxkj.logic.dao.impl;

import java.util.List;
import java.util.Map;

import org.springframework.dao.DataAccessException;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

import com.cssy.xxkj.logic.dao.LogicPurchaseWareItemDAO;
import com.cssy.xxkj.logic.entity.LogicPurchaseWareItemDO;
import com.plat.helper.SearchConditions;

/**
 * 数据访问对象实现类
 * @since 2014-09-19
 */
public class LogicPurchaseWareItemDAOImpl extends SqlMapClientDaoSupport implements LogicPurchaseWareItemDAO {

    /**
     * 插入数据
     * @param logicPurchaseWareItemDO
     * @return 插入数据的主键
     */
    public String insertLogicPurchaseWareItemDO(LogicPurchaseWareItemDO logicPurchaseWareItemDO) throws DataAccessException {
        Object id = getSqlMapClientTemplate().insert("LogicPurchaseWareItem.insert", logicPurchaseWareItemDO);
        return (String) id;
    }

    /**
     * 统计记录数
     * @param logicPurchaseWareItemDO
     * @return 查出的记录数
     */
    public Integer countLogicPurchaseWareItemDOByExample(LogicPurchaseWareItemDO logicPurchaseWareItemDO) throws DataAccessException {
        Integer count = (Integer) getSqlMapClientTemplate().queryForObject("LogicPurchaseWareItem.countByDOExample", logicPurchaseWareItemDO);
        return count;
    }

    /**
     * 更新记录
     * @param logicPurchaseWareItemDO
     * @return 受影响的行数
     */
    public Integer updateLogicPurchaseWareItemDO(LogicPurchaseWareItemDO logicPurchaseWareItemDO) throws DataAccessException {
        int result = getSqlMapClientTemplate().update("LogicPurchaseWareItem.update", logicPurchaseWareItemDO);
        return result;
    }

    /**
     * 获取对象列表
     * @param logicPurchaseWareItemDO
     * @return 对象列表
     */
    @SuppressWarnings("unchecked")
    public List<LogicPurchaseWareItemDO> findListByExample(LogicPurchaseWareItemDO logicPurchaseWareItemDO) throws DataAccessException {
        List<LogicPurchaseWareItemDO> list = getSqlMapClientTemplate().queryForList("LogicPurchaseWareItem.findListByDO", logicPurchaseWareItemDO);
        return list;
    }
    
    
    /**
     * 获取对象列表
     * @param paramMap
     * @return 对象列表
     */
    @SuppressWarnings("unchecked")
    public List<LogicPurchaseWareItemDO> findListByMap(Map<String, Object> paramMap) throws DataAccessException {
        List<LogicPurchaseWareItemDO> list = getSqlMapClientTemplate().queryForList("LogicPurchaseWareItem_ex.findListByMap", paramMap);
        return list;
    }
    
    /**
     * 根据主键获取logicPurchaseWareItemDO
     * @param id
     * @return logicPurchaseWareItemDO
     */
    public LogicPurchaseWareItemDO findLogicPurchaseWareItemDOByPrimaryKey(String id) throws DataAccessException {
        LogicPurchaseWareItemDO logicPurchaseWareItemDO = (LogicPurchaseWareItemDO) getSqlMapClientTemplate().queryForObject("LogicPurchaseWareItem.findByPrimaryKey", id);
        return logicPurchaseWareItemDO;
    }

    /**
     * 删除记录
     * @param id
     * @return 受影响的行数
     */
    public Integer deleteLogicPurchaseWareItemDOByPrimaryKey(String id) throws DataAccessException {
        Integer rows = (Integer) getSqlMapClientTemplate().delete("LogicPurchaseWareItem.deleteByPrimaryKey", id);
        return rows;
    }

	@Override
	public List<LogicPurchaseWareItemDO> find(SearchConditions scs)
			throws DataAccessException {
		List<LogicPurchaseWareItemDO> list = getSqlMapClientTemplate().queryForList("LogicPurchaseWareItem_ex.find", scs);
        return list;
	}

	@Override
	public Integer count(SearchConditions scs) throws DataAccessException {
		Integer count = (Integer) getSqlMapClientTemplate().queryForObject("LogicPurchaseWareItem_ex.count", scs);
        return count;
	}

	@Override
	public Integer deleteBizRemoved(String id) throws DataAccessException {
		// TODO Auto-generated method stub
		return null;
	}

}